<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
<title>增加一个器材</title>
</head>
<body>
<s:form name="f1" action="equipment_add" method="post" onsubmit="return check()">
		<tr><td>器材名称:</td><td><input type="text" name="name">
		<font color="red">*</font></td></tr>
		<tr><td>购买时间:</td><td><input type="date" name="buyTime">
		<font color="red">*</font></td></tr>
		<tr><td>价格:</td><td><input type="text" name="price">
		<font color="red">*</font></td></tr>
		<tr><td>其他信息:</td><td><textarea cols="20" rows="3" name="detail"></textarea>
		<font color="red">*</font></td></tr>
		<tr><td><input type="submit" value="提交" class="btn btn-info"/></td>
		<td><input type="reset" value="重置" class="btn btn-info"/></td></tr>
	</s:form>

<script type="text/javascript">
    function check(){
		var name = document.f1.name;
		var buyTime = document.f1.buyTime;
		var detail = document.f1.detail;
		var price = document.f1.price;
		var reNum =/^[0-9]+$/;
		if(name.value==""||buyTime.value==""||detail.value==""||price.value==""){
			alert("必填项不能为空！");
			return false;
		}
		if(!reNum.test(price.value)){
			alert("“价格必须为数字！");
			return false;
		}
		
		else{
			return true;
		}
	}
    </script>
</body>
</html>